<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<ng-container *ngIf="isCyberEngine">
    <h3 class="aui-gutter-column-lg">{{'common_setting_label' | i18n}}</h3>
    <lv-form [formGroup]="formGroup" [lvLabelColon]="false" class="formGroup" lvKeepRequiredWidth>
        <lv-form-item>
            <lv-form-label>
                {{'explore_learn_mode_label' | i18n}}
                <i lv-icon="aui-icon-help" [lv-tooltip]="helpTpl" lvTooltipPosition="rightTop" lvTooltipTheme="light"
                    class="configform-constraint" lvColorState='true'></i>
            </lv-form-label>
            <lv-form-control>
                <lv-switch formControlName="isOpen" [lvDisabled]="!isAllOceanProtect"></lv-switch>
            </lv-form-control>
        </lv-form-item>
        <ng-container *ngIf="formGroup.value.isOpen">
            <lv-form-item>
                <lv-form-label></lv-form-label>
                <lv-form-control>
                    <lv-radio-group formControlName="type">
                        <lv-group [lvGutter]="'30px'">
                            <lv-radio [lvValue]="dataMap.selfLearningType.day.value">
                                {{dataMap.selfLearningType.day.label | i18n}}
                                <i lv-icon="aui-icon-help"
                                    lv-tooltip="{{'explore_self_learnning_day_help_label' | i18n}}" lvColorState='true'
                                    class="help-desc"></i>
                            </lv-radio>
                            <lv-radio [lvValue]="dataMap.selfLearningType.times.value">
                                {{dataMap.selfLearningType.times.label | i18n}}
                                <i lv-icon="aui-icon-help"
                                    lv-tooltip="{{'explore_self_learnning_times_help_label' | i18n}}"
                                    lvColorState='true' class="help-desc"></i>
                            </lv-radio>
                        </lv-group>
                    </lv-radio-group>
                    <div class="aui-text-label">
                        {{'protection_reset_learning_type_label' | i18n}}
                    </div>
                </lv-form-control>
            </lv-form-item>
            <lv-form-item>
                <lv-form-label></lv-form-label>
                <lv-form-control>
                    <lv-form-item *ngIf="formGroup.value.type === dataMap.selfLearningType.day.value">
                        <lv-form-label lvRequired>
                            {{'common_time_label' | i18n}}
                        </lv-form-label>
                        <lv-form-control [lvErrorTip]='timesErrorTip'>
                            <lv-group lvGutter='8px'>
                                <input lv-input type="text" formControlName="day" class="duration-input"
                                    placeholder="{{isEn ? '15-60' : '15~60'}}" />
                                <span>{{'common_days_label' | i18n}}</span>
                            </lv-group>
                        </lv-form-control>
                    </lv-form-item>
                    <lv-form-item *ngIf="formGroup.value.type === dataMap.selfLearningType.times.value">
                        <lv-form-label lvRequired>
                            {{'common_number_times_label' | i18n}}
                        </lv-form-label>
                        <lv-form-control [lvErrorTip]='timesErrorTip'>
                            <lv-group lvGutter='8px'>
                                <input lv-input type="text" formControlName="times" class="duration-input"
                                    placeholder="{{isEn ? '15-60' : '15~60'}}" />
                                <span *ngIf="!isEn">{{'explore_times_label' | i18n}}</span>
                            </lv-group>
                        </lv-form-control>
                    </lv-form-item>
                </lv-form-control>
            </lv-form-item>
        </ng-container>
    </lv-form>
</ng-container>

<ng-template #helpTpl>
    <span innerHTML="{{'explore_self_learnning_help_label' | i18n}}"></span>
</ng-template>